//******************************************************
//* jonboy_debug.js
//******************************************************

// * * * Global Variables * * * 
jonboy_debug_level = 0;
var jonboy_debug_obj;

function jonboy_debug_begin(newlevel){
  jonboy_debug_level = newlevel;
  if (jonboy_debug_level > 0) {
    jonboy_debug_obj = OpenLog("debug.log");
  }
}

function jonboy_debug_write(currlevel, message) {
  if (currlevel <= jonboy_debug_level) {
    var spaces="";
    var i;
    for (i=0;i<currlevel;i++){spaces=spaces+" ";}
    jonboy_debug_obj.write(spaces + message);    
  }
}

// Convenience function
function jdw(currlevel, message) {
  jonboy_debug_write(currlevel, message);
}